package com.ruoyi.back.service.impl

import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import com.ruoyi.app.common.Data
import com.ruoyi.app.common.Ok
import com.ruoyi.back.domain.AliPaySetting
import com.ruoyi.back.mapper.AliPaySettingMapper
import com.ruoyi.back.service.AliPaySettingService
import org.springframework.stereotype.Service

@Service
class AliPaySettingServiceImpl : ServiceImpl<AliPaySettingMapper, AliPaySetting>(), AliPaySettingService {

    override fun saveAliPaySetting(aliPaySetting: AliPaySetting): Data<Boolean> =
        aliPaySetting.id?.run {
            Ok("更新成功", updateById(aliPaySetting))
        } ?: Ok("保存成功", save(aliPaySetting))


    override fun getAliPaySetting(): Data<AliPaySetting> =
        Ok("获取成功", getOne(KtQueryWrapper(AliPaySetting::class.java)))
}